export const useAuth = defineStore('auth', {
    state: () => ({
        auth: {
            isRegisterPageFlag: false,
            authMenus: [],
            userInfo: [] as unknown as UserInfoStructFormat
        },
    }),

    getters: {
        // 获取是否是注册页面flag
        getIsRegisterPageFlag: (state) => {
            return state.auth.isRegisterPageFlag;
        },

        // 获取权限菜单列表
        getAuthMenus: (state) => {
            return state.auth.authMenus;
        },

        // 获取用户信息
        getUserInfo: (state) => {
            return state.auth.userInfo;
        }
    },

    actions: {
        // 设置注册页面标志
        setIsRegisterPageFlag(flag: boolean) {
            this.auth.isRegisterPageFlag = flag;
        },

        // 设置权限菜单列表
        setAuthMenus(menus: any) {
            this.auth.authMenus = menus;
        },

        // 设置用户信息
        setUserInfo(userInfo: any) {
            this.auth.userInfo = userInfo;
        }
    }
})